// // Copyright (c) 2009 All Right Reserved // // vl // // 2009-01-01 // Contains ... using System.Text; namespace LargoCommon.Music { /// /// Melodic Item. /// public sealed class MelodicItem { #region Constructors /// /// Initializes a new instance of the class. /// /// The given bar. /// The given line. /// The given rhythmic structure. /// The given melodic structure. public MelodicItem(MusicalBar givenBar, int givenLineIndex, RhythmicStructure givenRhythmicStructure, MelodicStructure givenMelodicStructure) { this.MusicalBar = givenBar; this.LineIndex = givenLineIndex; this.RhythmicStructure = givenRhythmicStructure; this.MelodicStructure = givenMelodicStructure; this.IsCovered = false; } #endregion #region Properties /// /// Gets or sets a value indicating whether this instance is covered. /// /// /// True if this instance is covered; otherwise, false. /// public bool IsCovered { get; set; } /// /// Gets or sets a value indicating whether this instance is like motive start. /// /// /// True if this instance is like motive start; otherwise, false. /// public bool IsLikeMotiveStart { get; set; } /// /// Gets or sets a value indicating whether this instance is like motive end. /// /// /// True if this instance is like motive end; otherwise, false. /// public bool IsLikeMotiveEnd { get; set; } /// /// Gets the line number. /// /// Property description. public int LineIndex { get; } /// /// Gets or sets the musical tones. /// /// /// The musical tones. /// public MusicalStrikeCollection MusicalTones { get; set; } /// /// Gets or sets the melodic tones. /// /// /// The melodic tones. /// public MusicalToneCollection MelodicTones { get; set; } /// /// Gets the musical bar. /// /// /// The musical bar. /// public MusicalBar MusicalBar { get; } /// /// Gets the rhythmic structure. /// /// /// The rhythmic structure. /// public RhythmicStructure RhythmicStructure { get; } /// /// Gets the melodic structure. /// /// /// The melodic structure. /// public MelodicStructure MelodicStructure { get; } #endregion #region String representation /// /// Returns a that represents this instance. /// /// /// A that represents this instance. /// public override string ToString() { var s = new StringBuilder(); s.AppendFormat("Bar {0}, ", this.MusicalBar.BarNumber); s.AppendFormat("Line {0}, ", this.LineIndex); s.Append(this.RhythmicStructure == null ? string.Empty : this.RhythmicStructure.ElementSchema + ", "); s.Append(this.MelodicStructure == null ? string.Empty : this.MelodicStructure.ElementSchema); s.Append(this.IsLikeMotiveStart ? " START" : string.Empty); s.Append(this.IsLikeMotiveEnd ? " END" : string.Empty); return s.ToString(); } #endregion } }